<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<script type="text/javascript" src="js/ddm.js"></script>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script type="text/javascript">
<!--

//-->

function CheckCheckAll(Check_ctr) {
	chk = document.getElementsByName('selectedCategory');
	if (Check_ctr.checked == true) {
		chk.checked = true;
		for (i = 0; i < chk.length; i++) {
			chk[i].checked = true;
		}
	} else {
		chk.checked = false;
		for (i = 0; i < chk.length; i++) {
			chk[i].checked = false;
		}
	}
}

function deleteProfile() {
	var flag = false;
	chk = document.getElementsByName('selectedCategory');
	for (i = 0; i < chk.length; i++) {
		if(chk[i].checked == true) {
			flag = true;
			break;
		}
	}

	if(flag) {
		return wantToDelete('Want to delete selected profiles?');
	} else {
		alert('Select at least one profile to delete...');
		return false;
	}
}
</script>

<table width="100%">
	<tr>
		<td>
			<div class="blue-text16" style="margin: 0px 0px 0px 0px">
				<table width="100%">
					<tr>
						<td class="heding" align="left">
							<s:text name="addCompanyProfileToFavorite.heading" />
						</td>
						<td align="left">
							<a href="addToFavoriteCompanyProfile.htm" class="common-link"><s:text name="addToFavoriteCompanyProfile.title" /></a>
						</td>
					</tr>
				</table>
			</div>
			<div class="header-separator-bg" style="margin: 10px 5px 17px 0px"></div>
			<div style="margin: 0px 0px 12px 0px">


			<s:form action="deleteMultiFavoriteProfiles.htm" method="post" theme="simple" onsubmit="return deleteProfile()">

				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tbody>
						<tr>
							<td width="100%">
								<table border="0" cellpadding="0" cellspacing="0" width="100%">
									<tbody>
										<display:table name="favoritesProfileList" pagesize="10"
											requestURI="favoriteProfile.htm" id="row">
											<display:column title="<input type='checkbox' name='selectall' onclick='CheckCheckAll(this)' />" style="width: 5%; text-align: center" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
												<s:checkbox name="selectedCategory" theme="simple" fieldValue="%{#attr.row.id}"/>
											</display:column>
											<display:column title="Title" style="width: 40%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
											 	<a href="browseItems.htm?titleValue=${row.name}&type=6&city=${row.location}&locations=${row.region.categoryId}&cid=${row.generalCategories.categoryId}"  /><s:property value="#attr.row.name" /></a>
											</display:column>
											<display:column value="${row.generalCategories.categoryName}" title="Category" style="width: 15%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link" />
											<display:column property="location" title="Location" style="width: 15%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link" />
											<display:column title="Added" style="width: 15%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
												<s:date name="%{#attr.row.date}" format="dd MMMM yyyy" />
											</display:column>
											<display:column autolink="true" title="Options" paramProperty="id" href="addToFavorite.htm" paramId="id" style="width: 10%" class="grid-bg common-text" headerClass="grid-header-bg grid-header-text-link">
												<table>
													<tr>
														<td align="center" valign="top" class="grid-bg common-text" id="mddm" width="10%">
															<a class="mddm" href="#" onmouseover="mopen('<s:property value="%{#attr.row.id}"/>', this, 'common-link', 'right', 1)"
																onmouseout="mclosetime()">Select</a>
															<div style="visibility: hidden;" id="<s:property value="%{#attr.row.id}"/>"
																onmouseover="mcancelclosetime()"
																onmouseout="mclosetime()">
																	<s:a href="javascript: wantToDeleteWithURL('deleteFavoriteProfile.htm?uid=%{#attr.row.id}', 'Do you want to delete this profile?')">Delete</s:a>
																	<s:a href="editFavoriteProfile.htm?uid=%{#attr.row.id}">Edit</s:a>
																	<s:a href="viewSellersOtherItems.htm?userId=%{#attr.row.user.id}&action=favoriteProfile">View sellers other items</s:a>
																	<s:a href="userShop.htm?userId=%{#attr.row.user.userId}">View sellers shop</s:a>
																	<s:a href="myWanted.htm?userId=%{#attr.row.user.id}&action=favoriteProfile">Items wanted</s:a>
															</div>
														</td>
													</tr>
												</table>
											</display:column>
											<display:column>
												<tr>
													<td colspan="6" bgcolor="#ffffdd">
														<c:out value="${row.note}"></c:out>
													</td>
												</tr>
											</display:column>
										</display:table>
										<tr>
											<td width="100%">
												<table border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td><img src="images/middle/btn-grey-left1.gif" alt=" " width="6" height="23" /></td>
														<td class="btn-grey-middle1 "><s:submit name="delete" value="delete" align="left" theme="simple" cssClass="submit-btn-common" /></td>
														<td><img src="images/middle/btn-grey-right1.gif" alt=" " width="6" height="23" /></td>
													</tr>
												</table>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
					</tbody>
				</table>
			</s:form>
		</div>
		</td>
	</tr>
</table>